package _Pan3D.role
{
	import _me.Scene_data;
	
	import flash.display3D.Context3D;
	
	public class Hero extends Role
	{
		public var target:Npc;
		public var state:String;
		public var pathEndX:int;
		public var pathEndZ:int;
		public function Hero(context:Context3D, info:RoleVo)
		{
			super(context, info);
			//this.minDistance = 20;
		}
		override public function update():void{
			super.update();
			Scene_data.focus3D.x=this.x;
			Scene_data.focus3D.z=this.z;
			this.y = 0;
		}
		/*override public function stop():void{
			if(target){
				this.attack("attack");
			}else{
				super.stop();
			}
		}*/
		
		override public function moveEnd():void{
			continueAttack();
		}
		
		private function continueAttack():void{
			if(target){
				state = "attack";
				target.clearAI();
				this.attack("attack");
				target.attack("attack");
				target.rotationY = this.rotationY - 180;
				target.life -= 30;
				if(target.life <= 0){
					target.lifeDead();
					state = null;
					target = null;
				}
			}
		}
		
		override public function playOver():void{
			if(state == "attack"){
				continueAttack();
			}else{
				super.playOver();
			}
		}
		
		
	}
}